Here are some snippets of AppleScript that you might find handy.
Prepend to the top of a page:
tell application "VoodooPad" prepend text "this goes at the top" & return to page "index" of document 1 end tell
Append to the bottom of a page:
tell application "VoodooPad" append text return & "this goes at the bottom" to page "index" of document 1 end tell
Create a new page:
tell application "VoodooPad" tell document 1 to create page with title "new page" with contents "This is a new page." end tell
Export to iPod:
tell application "VoodooPad"
-- this is the path to your document.
open "srv:Users:gus:Desktop:astest.vdoc" as alias
tell front document
export to ipod
end tell
end tell
Getting text from a specific page:
tell application "VoodooPad" set theString to (text of page "index" of document 1) as string end tell
A useless example that loops through all the pages and displays it's name and contents
tell application "VoodooPad"
tell document 1
repeat with i from 1 to number of items in pages
set s to text of page i
set n to name of page i
display dialog n & return & s
end repeat
end tell
end tell
An example that loops through all the pages, and prepends some text to every page
tell application "VoodooPad"
repeat with i from 1 to number of items in pages of document 1
set n to name of page i of document 1
prepend text "your text here" & return to page n of document 1
end repeat
end tell
New in 2.5:
Sort and pull out pages by create page:
tell application "VoodooPad"
set theDoc to first document
tell theDoc
set myList to page keys sorted by create date
repeat with idx from 1 to number of items in myList
set pageName to item idx of myList
set s to text of (page pageName of theDoc)
-- now do something exciting with s
end repeat
-- we could have also done:
set myList to page keys sorted by modified date
set myList to page keys sorted -- default, sorted by key
end tell
end tell